package com.woniuxy.hw;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

@Configuration
public class HoWorkConfig {

    @Bean
    @Primary
    public FanoutExchange fanoutExchangeEmail() {
        return new FanoutExchange("hw_fanout_exchange");
    }
    @Bean
    public Queue welcomeQueue() {
        return new Queue("hw_welcome_queue");
    }
    @Bean
    public Binding welcomeBinding(FanoutExchange fanoutExchangeEmail, Queue welcomeQueue) {
        return BindingBuilder.bind(welcomeQueue).to(fanoutExchangeEmail);
    }

}
